package com.google.zxing.client.android;

public class ThreadProperty {

	private static ThreadProperty INSTANCE = null;
	private int threadNumber = 1;
	private long time = Long.MAX_VALUE;
	private int iterationNumber = 1;

	// Private constructor suppresses
	private ThreadProperty() {
	}

	private synchronized static void createInstance() {
		if (INSTANCE == null) {
			INSTANCE = new ThreadProperty();
		}
	}

	public static ThreadProperty getInstance() {
		createInstance();
		return INSTANCE;
	}

	public int getThreadNumber() {
		return threadNumber;
	}

	public void setThreadNumber(int threadNumber) {
		this.threadNumber = threadNumber;
	}

	public long getTime() {
		return time;
	}

	public void setTime(long time) {
		this.time = time;
	}

	public void addTime(long time) {
		this.time += time;
	}

	public void timeAverage(int average) {
		this.time = this.time / average;
	}

	public void timeMin(long time) {
		if (time < this.time) {
			this.time = time;
		}
	}

	public int getIterationNumber() {
		return iterationNumber;
	}

	public void setIterationNumber(int iterationNumber) {
		this.iterationNumber = iterationNumber;
	}

}
